home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / WMS.CAB / wmsToolbar.inc < prev    next >
Encoding:
Text File  |  2003-02-21  |  15.2 KB  |  434 lines

  1. <%
  2. '+-------------------------------------------------------------------------
  3. '
  4. '  Microsoft Windows Media
  5. '  Copyright (C) Microsoft Corporation. All rights reserved.
  6. '
  7. '  File:       Toolbar.asp
  8. '
  9. '  Contents:    Draws the toolbar found on the bottom of each page
  10. '
  11. '  Dependencies: LocStrings.asp, WMSConstnats.asp
  12. '
  13. '--------------------------------------------------------------------------
  14.  
  15. rem *** paths to PUBLISHING POINT tabs' images ***
  16. Const IMAGE_PP_ADD = "img/addpp_icon32.gif"
  17. Const IMAGE_PP_PPADD = "img/addppt_icon32.gif"
  18. Const IMAGE_PP_STARTRECORD = "img/startrecord_icon32.gif"
  19. Const IMAGE_PP_STARTRECORDG = "img/startrecordg_icon32.gif"
  20. Const IMAGE_PP_STOPRECORD = "img/stoprecord_icon32.gif"
  21. Const IMAGE_PP_STOPRECORDG = "img/stoprecordg_icon32.gif"
  22. Const IMAGE_PP_START = "img/start_icon32.gif"
  23. Const IMAGE_PP_STARTG = "img/startg_icon32.gif"
  24. Const IMAGE_PP_DISCONNECT = "img/disconnect_icon32.gif"
  25. Const IMAGE_PP_DISCONNECTG = "img/disconnectg_icon32.gif"
  26. Const IMAGE_PP_ONDEMAND = "img/ondemand_icon32.gif"
  27. Const IMAGE_PP_ONDEMANDSTOP = "img/ondemand_stop32.gif"
  28. Const IMAGE_PP_ONDEMAND_ERR = "img/ondemand_error32.gif"
  29. Const IMAGE_PP_ONDEMAND_DENY = "img/ondemand_deny32.gif"
  30. Const IMAGE_PP_BROADCASTENDED = "img/BroadcastPushStreamEnd_32.gif"
  31. Const IMAGE_PP_BROADCAST = "img/broadcast_icon32.gif"
  32. Const IMAGE_PP_BCASTSTOPPED = "img/broadcast_stop32.gif"
  33. Const IMAGE_PP_BROADCAST_ERR = "img/broadcast_error32.gif"
  34. Const IMAGE_PP_BROADCAST_DENY = "img/broadcast_deny32.gif"
  35. Const IMAGE_PP_BROADCAST_PUSH = "img/broadcast_push32.gif"
  36. Const IMAGE_PP_BCASTDENY_PUSH = "img/BroadcastPushDeny_32.gif"
  37. Const IMAGE_PP_BCASTSTOP_PUSH = "img/BroadcastPushStop_32.gif"
  38. Const IMAGE_PP_BCASTERR_PUSH = "img/BroadcastPushCritical_32.gif"
  39. Const IMAGE_PP_DUP = "img/duplicateppt_icon32.gif"
  40.  
  41. rem *** paths to SERVER tabs' images ***
  42. Const IMAGE_SERVER = "img/server_icon32.gif"
  43. Const IMAGE_SERVERSTOP = "img/server_stop_32.gif"
  44. Const IMAGE_SERVERDENY = "img/server_deny32.gif"
  45. Const IMAGE_SERVERERR = "img/server_error32.gif"
  46. Const IMAGE_SERVERWARN = "img/server_warning32.gif"
  47. Const IMAGE_STOP = "img/stop_icon32.gif"
  48. Const IMAGE_ALLOWCONNECTIONS = "img/allownew_icon32.gif"
  49. Const IMAGE_DENYCONNECTIONS = "img/denynew_icon32.gif"
  50. Const IMAGE_ALLOWCONNECTIONSG = "img/allownewg_icon32.gif"
  51. Const IMAGE_DENYCONNECTIONSG = "img/denynewg_icon32.gif"
  52. Const IMAGE_RESETPEAKS = "img/resetpeak_icon32.gif"
  53. Const IMAGE_ENABLE = "img/enable_icon32.gif"
  54. Const IMAGE_ENABLEG = "img/enableg_icon32.gif"
  55. Const IMAGE_DISABLE = "img/disable_icon32.gif"
  56. Const IMAGE_DISABLEG = "img/disableg_icon32.gif"
  57. Const IMAGE_REMOVE = "img/remove_icon_32.gif"
  58. Const IMAGE_REMOVEG = "img/removeg_icon32.gif"
  59. Const IMAGE_RENAME = "img/rename_icon32.gif"
  60. Const IMAGE_RENAMEG = "img/renameg_icon32.gif"
  61. Const IMAGE_PLUGINDUPLICATE = "img/dupplugin_icon32.gif"
  62. Const IMAGE_PLUGINDUPLICATEG = "img/duppluging_icon32.gif"
  63. Const IMAGE_PROPERTIES = "img/properties_icon32.gif"
  64. Const IMAGE_PROPERTIESG = "img/propertiesg_icon32.gif"
  65. Const IMAGE_REFRESH = "img/refresh_icon32.gif"
  66. Const IMAGE_CLEARLIST = "img/clearall_icon32.gif"
  67. Const IMAGE_CLEARLISTG = "img/clearallg_icon32.gif"
  68. Const IMAGE_HELP = "img/help_icon32.gif"
  69. Const IMAGE_SERVERLIST = "img/serverlist_icon32.gif"
  70. Const IMAGE_STOPG = "img/stopg_icon32.gif"
  71. Const IMAGE_STARTG = "img/startg_icon32.gif"
  72.  
  73. rem *** paths to tabs' help ***
  74. Const SERVERHELP_PATH = "../help/default.htm"
  75. Const PUBPOINTHELP_PATH = "../../help/default.htm"
  76.  
  77. Const SERVERSLIST_PATH = "JavaScript:ShowServerList();"
  78. Const PUBPOINTSLIST_PATH = "/wmssecure/pages/pubpoints/pubpoint_collection.asp?show=true"
  79.  
  80. Const SLISTTARGET = "target=sList"
  81. Const HELPTARGET = "target=help"
  82.  
  83. Const QUOTE_CHAR = 34
  84. Const ICON_SIZE = 32
  85. Const TOOLBARWRAP = 11
  86.  
  87. rem *** do not localize
  88. Const HELPTOKEN = "_HELP"
  89.  
  90. Dim ToolbarButtonText( 12 )
  91. Dim ToolbarButtonAltText( 12 )
  92. Dim ToolbarButtonImage( 12 )
  93. Dim ToolbarButtonImageDisabled( 12 )
  94. Dim ToolbarButtonLink( 12 )
  95. Dim ToolbarButtonLinkArgs( 12 )
  96.  
  97. Dim ToolbarHelpURL
  98. Dim ToolbarNesting
  99.  
  100. g_dwBrowserType = Session( "BrowserType" )
  101.  
  102. '/////////////////////////////////////////////////////////////////////////////////////
  103. '
  104. ' Called at the bottom of a page implementing error handling.  Determines if we need
  105. '  to re-load the page to display error messages or just clear the error state vars.
  106. '
  107. sub DrawToolbar( bIsPubPoint, dwNumElements )
  108.     on error resume next
  109.     Response.Flush
  110.     Dim i
  111.     Dim bDisabledImageSpecified
  112.         
  113.     %> <!-- BEGIN TOOLBAR -->
  114.             <div id="toolbarTable">
  115.             <table cellspacing="0" cellpadding="0" border="0" oncontextmenu="JavaScript:event.cancelBubble=true;return false;">
  116.             <tr>
  117.     <%
  118.  
  119.     bDisabledImageSpecified = FALSE
  120.     i = 0
  121.     while( ( i < 12 ) and ( not bDisabledImageSpecified ) )
  122.         if( "" <> ToolbarButtonImageDisabled( i ) ) then
  123.             bDisabledImageSpecified = TRUE
  124.         end if
  125.         i = i + 1
  126.     wend
  127.     
  128.     i = 0
  129.     while( i < dwNumElements )
  130.         
  131.         if( 12 <= Len( ToolbarButtonText( i ) ) ) then
  132.             if( TRUE = LONGTOOLBARNAMES ) then
  133.                 dwButtonWidth = 105
  134.                 dwButtonHeight = 105
  135.             else
  136.                 dwButtonWidth = 85
  137.                 dwButtonHeight = 85
  138.             end if
  139.         else
  140.             dwButtonWidth = 72
  141.             dwButtonHeight = 72
  142.         end if
  143.         ' Wrap the toolbar if it is too long
  144.         if( ( 0 <> i ) and ( 0 = i mod TOOLBARWRAP ) ) then
  145.             %></tr><tr><%
  146.         end if %>
  147.             <td valign="top">
  148.                 <center><%
  149.         if( 0 < Len( ToolbarButtonLink( i ) ) ) then
  150.             if( HELPTOKEN = ToolbarButtonLink( i ) ) then %>
  151.                     <table hspace="2px" vspace="2px" align="middle" valign="top" border="0" cellspacing="5" cellpadding="0" height="<%= dwButtonHeight %>" width="<%= dwButtonWidth %>">
  152.                     <tr>
  153.                         <td valign="top" onclick="<% if bDisabledImageSpecified then %>Check<% end if %>OnClickToolbar( 'toolbar_<%= i %>', 'toolbarLink_<%= i %>' );" >
  154.                             <center>
  155.                             <div onclick="<% if bDisabledImageSpecified then %>Check<% end if %>OnClickToolbar( <%= i %>, 'toolbar_<%= i %>', 'toolbarLink_<%= i %>' );" onmousedown="<% if bDisabledImageSpecified then %>Check<% end if %>OnMouseDown( <%= i %>, 'toolbar_<%= i %>' );" onmouseenter="<% if bDisabledImageSpecified then %>Check<% end if %>OnMouseEnter( <%= i %>, 'toolbar_<%= i %>' );" onlosecapture="<% if bDisabledImageSpecified then %>Check<% end if %>ResetToolbarEntry( <%= i %>, 'toolbar_<%= i %>' );" onmouseleave="<% if bDisabledImageSpecified then %>Check<% end if %>OnMouseLeave( <%= i %>, 'toolbar_<%= i %>' );" title="<%= ToolbarButtonAltText( i ) %>" class="toolbarnormal" name="toolbar_<%= i %>" id="toolbar_<%= i %>">
  156.                             <a class="toolbarnormal" id="toolbarLink_<%= i %>" href="JavaScript:DoHelp('<%= ToolbarNesting %>','<%= ToolbarHelpURL %>');" tabIndex=<%= dwTabIndex %> <% dwTabIndex = dwTabIndex + 1 %>><%
  157.             else %>
  158.                     <table hspace="2px" vspace="2px" align="middle" valign="top" border="0" cellspacing="5" cellpadding="0" height="<%= dwButtonHeight %>" width="<%= dwButtonWidth %>">
  159.                     <tr>
  160.                         <td valign="top" onclick="OnClickToolbar( 'toolbar_<%= i %>', 'toolbarLink_<%= i %>' );" >
  161.                             <center>
  162.                             <div onclick="<% if bDisabledImageSpecified then %>Check<% end if %>OnClickToolbar( <%= i %>, 'toolbar_<%= i %>', 'toolbarLink_<%= i %>' );"  onmousedown="<% if bDisabledImageSpecified then %>Check<% end if %>OnMouseDown( <%= i %>, 'toolbar_<%= i %>' );" onmouseenter="<% if bDisabledImageSpecified then %>Check<% end if %>OnMouseEnter( <%= i %>, 'toolbar_<%= i %>' );" onlosecapture="<% if bDisabledImageSpecified then %>Check<% end if %>ResetToolbarEntry( <%= i  %>, 'toolbar_<%= i %>' );" onmouseleave="<% if bDisabledImageSpecified then %>Check<% end if %>OnMouseLeave( <%= i %>, 'toolbar_<%= i %>' );" title="<%= ToolbarButtonAltText( i ) %>" class="toolbarnormal" name="toolbar_<%= i %>" id="toolbar_<%= i %>">
  163.                             <a class="toolbarnormal" id="toolbarLink_<%= i %>" href="<%= ToolbarButtonLink( i ) %>" <%= ToolbarButtonLinkArgs( i ) %> tabIndex=<%= dwTabIndex %> <% dwTabIndex = dwTabIndex + 1 %>><%
  164.             end if
  165.         else %>
  166.                     <table align="middle" valign="top" border="0" cellspacing="5" cellpadding="0" height="<%= dwButtonHeight %>" width="<%= dwButtonWidth %>" disabled >
  167.                     <tr>
  168.                         <td valign="top" >
  169.                             <center>
  170.                             <div class="toolbargray"><%
  171.         end if %>
  172.                                 <img ID="toolbarImage<%= i %>" src="<%= ToolbarButtonImage( i ) %>" border="0" width="<%= ICON_SIZE %>" height="<%= ICON_SIZE %>"<%
  173.         if( "" <> ToolbarButtonAltText ) then 
  174.             %> ALT= "<%= ToolbarButtonAltText( i ) %>"<%
  175.         end if 
  176.         %> ><br><%= ToolbarButtonText( i ) %>
  177.         <%
  178.         if( "" <> ToolbarButtonLink( i ) ) then
  179.         %></a><%
  180.         end if %>
  181.                             </div>
  182.                             </center>
  183.                         </td>
  184.                     </tr>
  185.                     </table>
  186.                 </center>
  187.             </td valign="top"><%
  188.         i = i + 1
  189.     wend
  190.     %>
  191.        </tr>
  192.     </table>
  193.     </div>
  194. <% if bDisabledImageSpecified then %>
  195. <script language="JavaScript">
  196. /*@cc_on @*/
  197. <% if brMSIE = g_dwBrowserType then %>
  198. var g_rgEnabledImages = new Array();
  199. var g_rgDisabledImages = new Array();
  200. var g_rgEnabled = new Array();
  201. var g_bPopulated = false;
  202. var g_bToolbarLoaded = false;
  203. <% end if %>
  204. /////////////////////////////////////////////////////////////////
  205. function PopulateArrays( dwWhichItem )
  206. {
  207.     <% jsTRY %>
  208. <% if( brMSIE <> g_dwBrowserType ) then %>return;<% else %>
  209.     g_bPopulated = true;
  210. <%
  211.     i = 0
  212.     while( i < dwNumElements )
  213.         if( 0 < Len( ToolbarButtonImageDisabled( i ) ) ) then
  214. %>
  215.     g_rgEnabledImages[ <%= i %> ] = new Image();
  216.     g_rgEnabledImages[ <%= i %> ].src = "<%= ToolbarButtonImage( i ) %>";
  217.     g_rgDisabledImages[ <%= i %> ] = new Image();
  218.     g_rgDisabledImages[ <%= i %> ].src = "<%= ToolbarButtonImageDisabled( i ) %>";
  219. <%
  220.         end if
  221.         i = i + 1
  222.     wend 
  223.  
  224.     i = 0
  225.     while( i < dwNumElements )
  226.     %>
  227.     g_rgEnabled[ <%= i %> ] = true;
  228.     <%
  229.         i = i + 1
  230.     wend
  231. %>
  232. <% end if %>
  233.     <% jsCATCH %>
  234. }
  235.  
  236. /////////////////////////////////////////////////////////////////
  237. function CheckOnMouseDown( dwWhichItem, szToolbarItem )
  238. {
  239.     <% jsTRY %>
  240. <% if( brMSIE <> g_dwBrowserType ) then %>return;<% else %>
  241.     if( ! g_bToolbarLoaded )
  242.     {
  243.         return;
  244.     }
  245.     
  246.     if( ! g_bPopulated )
  247.     {
  248.         PopulateArrays();
  249.     }
  250.     
  251.     if( g_rgEnabled[ dwWhichItem ] )
  252.     {
  253.         OnMouseDown( szToolbarItem );
  254.     }
  255. <% end if %>
  256.     <% jsCATCH %>
  257. }
  258.  
  259. /////////////////////////////////////////////////////////////////
  260. function CheckOnClickToolbar( dwWhichItem, szName, szLinkName )
  261. {
  262.     <% jsTRY %>
  263. <% if( brMSIE <> g_dwBrowserType ) then %>return;<% else %>
  264.     if( ! g_bToolbarLoaded )
  265.     {
  266.         return;
  267.     }
  268.  
  269.     if( ! g_bPopulated )
  270.     {
  271.         PopulateArrays();
  272.     }
  273.     
  274.     if( g_rgEnabled[ dwWhichItem ] )
  275.     {
  276.         OnMouseUp( szName );
  277.         OnClickToolbar( dwWhichItem, szName, szLinkName );
  278.     }
  279.     else
  280.     {
  281. //        ResetToolbarEntry( dwWhichItem, szName );
  282.         event.cancelBubble=true;
  283.         return( false );
  284.     }
  285. <% end if %>
  286.     <% jsCATCH %>
  287. }
  288.  
  289. /////////////////////////////////////////////////////////////////
  290. function CheckOnMouseEnter( dwWhichItem, szName )
  291. {
  292.     <% jsTRY %>
  293. <% if( brMSIE <> g_dwBrowserType ) then %>return;<% else %>
  294.     if( ! g_bToolbarLoaded )
  295.     {
  296.         return;
  297.     }
  298.     
  299.     if( ! g_bPopulated )
  300.     {
  301.         PopulateArrays();
  302.     }
  303.     
  304.     var szItemName = "toolbar_" + dwWhichItem;
  305.     var szItemLinkName = "toolbarLink_" + dwWhichItem;
  306.     if( g_rgEnabled[ dwWhichItem ] )
  307.     {
  308.         OnMouseEnter( dwWhichItem, szName );
  309.         document.all[ szItemName ].style.cursor = "hand";
  310.         document.all[ szItemLinkName ].style.cursor = "hand";
  311.     }
  312.     else
  313.     {
  314.         document.all[ szItemName ].style.cursor = "default";
  315.         document.all[ szItemLinkName ].style.cursor = "default";
  316.     }
  317. <% end if %>
  318.     <% jsCATCH %>
  319. }
  320.  
  321. /////////////////////////////////////////////////////////////////
  322. function CheckResetToolbarEntry( dwWhichItem, szName )
  323. {
  324.     <% jsTRY %>
  325. <% if( brMSIE <> g_dwBrowserType ) then %>return;<% else %>
  326.     if( ! g_bToolbarLoaded )
  327.     {
  328.         return;
  329.     }
  330.     
  331.     if( ! g_bPopulated )
  332.     {
  333.         PopulateArrays();
  334.     }
  335.     
  336.     if( g_rgEnabled[ dwWhichItem ] )
  337.     {
  338.         ResetToolbarEntry( dwWhichItem, szName );
  339.     }
  340. <% end if %>
  341.     <% jsCATCH %>
  342. }
  343.  
  344. /////////////////////////////////////////////////////////////////
  345. function CheckOnMouseLeave( dwWhichItem, szName )
  346. {
  347.     <% jsTRY %>
  348. <% if( brMSIE <> g_dwBrowserType ) then %>return;<% else %>
  349.     if( ! g_bToolbarLoaded )
  350.     {
  351.         return;
  352.     }
  353.     
  354.     if( ! g_bPopulated )
  355.     {
  356.         PopulateArrays();
  357.     }
  358.     
  359.     if( g_rgEnabled[ dwWhichItem ] )
  360.     {
  361.         OnMouseLeave( dwWhichItem, szName );
  362.     }
  363. <% end if %>
  364.     <% jsCATCH %>
  365. }
  366.  
  367. /////////////////////////////////////////////////////////////////
  368. function EnableToolbarItem( dwWhichItem, bEnable )
  369. {
  370.     <% jsTRY %>
  371. <% if( brMSIE <> g_dwBrowserType ) then %>return;<% else %>
  372.         if( ! g_bPopulated )
  373.         {
  374.             PopulateArrays();
  375.         }
  376.  
  377.         if( dwWhichItem >= <%= dwNumElements %> )
  378.         {
  379.             return;
  380.         }
  381.  
  382.         var szLinkName = new String( "toolbarLink_" );
  383.         szLinkName += dwWhichItem;
  384.  
  385.         var szImageName = new String( "toolbarImage" );
  386.         szImageName += dwWhichItem;
  387.  
  388.         if( document.all[ szLinkName ] )
  389.         {
  390.             document.all[ szLinkName ].disabled = ! bEnable;
  391.         }
  392.  
  393.         g_rgEnabled[ dwWhichItem ] = bEnable;
  394.         if( bEnable )
  395.         {
  396.             if( ( document.images[ szImageName ] ) && ( g_rgEnabledImages[ dwWhichItem ] ) )
  397.             {
  398.                 document.images[ szImageName ].src = g_rgEnabledImages[ dwWhichItem ].src;
  399.             }
  400.         }
  401.         else
  402.         {
  403.             if( ( document.images[ szImageName ] ) && ( g_rgDisabledImages[ dwWhichItem ] ) )
  404.             {
  405.                 document.images[ szImageName ].src = g_rgDisabledImages[ dwWhichItem ].src;
  406.             }
  407.         }
  408.  
  409.         var szItemName = "toolbar_" + dwWhichItem;
  410.         if( bEnable )
  411.         {
  412.             if( document.all[ szItemName ] )
  413.             {
  414.                 document.all[ szItemName ].style.cursor = "hand";
  415.             }
  416.         }
  417.         else
  418.         {
  419.             if( document.all[ szItemName ] )
  420.             {
  421.                 document.all[ szItemName ].style.cursor = "default"; // = "toolbargray";   
  422.             }
  423.         }
  424. <% end if %>
  425.     <% jsCATCH %>
  426. }
  427. </script>
  428. <% end if %>
  429. <!-- END TOOLBAR -->
  430.     <%
  431. End Sub
  432. %>
  433.  
  434.